# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=stardict
pkgver=3.0.6
pkgrel=6
pkgdesc="Cross-platform and international dictionary software"
url="https://stardict-4.sourceforge.net/"
#arch="all"
arch=""
license="GPL-3.0-or-later"
makedepends="automake autoconf libtool gtk+2.0-dev libsigc++-dev libxml2-dev
	gnome-common enchant2-dev espeak-dev zlib-dev mariadb-connector-c-dev pcre-dev"
subpackages="$pkgname-doc $pkgname-lang $pkgname-help::noarch"
source="https://downloads.sourceforge.net/project/stardict-4/$pkgver/stardict-$pkgver.tar.bz2
	gcc46.patch
	glib2.patch
	mariadb.patch
	gconf.patch
	enchant2.patch
	makefile.patch
	gnome-doc-utils.patch
	"
options="!check"

prepare() {
	default_prepare

	update_config_sub

	# Ensure system libsigc++ is used
	find dict/src/sigc++* -type f \( -name \*.h -o -name \*.cc \) -delete
}

build() {
	./autogen.sh

	export CXXFLAGS="$CXXFLAGS -std=gnu++11"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-gnome-support \
		--disable-dictdotcn \
		--disable-gucharmap \
		--disable-scrollkeeper \
		--disable-festival \
		--disable-updateinfo \
		--disable-gpe-support \
		--disable-schemas-install
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

help() {
	pkgdesc="Stardict help files"
	install_if="stardict=$pkgver-r$pkgrel"

	amove usr/share/stardict/help
}

sha512sums="
81d93324b6e8954af7c20ea6d2a3054bb564d786a21b1cb541c728da7a18a6e7ddb23e595055ccc77e6866bbb8c89fb4f17023e33664761dbe1ee8cd55768658  stardict-3.0.6.tar.bz2
cc43b57cdf2e7fbd3e9c86acb4c8f9fef367d68f6f027e75774eec9cdf66b3fdd3b0bc58d373d076cb38671e09012ab69b8b7e81638a5be888af56372e65a838  gcc46.patch
4132eee58ab5dfb30105fd2c1a113d143528f7e904ededbb8de203bbb244377aed2c152aae7f383936e74005c2f4afa6128674a245d2a8083b2757b1ca90dd24  glib2.patch
4b47cd6beb425316cdbe45ec8b6b965521ba20a956fe6a39a49da0b5e774b3ff5bc8ade19aa03216d3405ec7fbee9ed37add0a7ec07c090a6872eb2ae2654db9  mariadb.patch
efa225a0ff285ee81788311c0ed9875ebc93d64fb4943b8de6ba27d945e781936eebcab4c742b29cb6c8c810f5fd3f478db98cb06128e7aa552fb8512838bad6  gconf.patch
bc41bb144275297657424a3a41e27cab6c06fcdecbb470e6f2b9204c01c0a9e74e64e8db6da5343e9b7779eb67f19dc786ec5617b1607c39e1a6034966b96447  enchant2.patch
f7f96979e620195b09b0b6f4183401886637badeb7c91f1889409a5ee206ac2d1e33072ae31cdde9464510406c7bb0162083b3003b7715aa9ab3c3f1df1923ab  makefile.patch
9900c1f5aabd100f873d8903a61a4ea71118ea70236cc0fa10bafcb9a87335e686c840ee258af64c0c9aaa8ea62e71acd80d2b8839e42fd5280f8d1e2209deb6  gnome-doc-utils.patch
"
